Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't ICE on operator trait methods with generic methods #104216

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

Noratrieb
Copy link
Member

@Noratrieb Noratrieb commented Nov 9, 2022

Emit a fatal error instead.
fixes #104213

@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2022

r? @estebank

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 9, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2022

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@Noratrieb Noratrieb force-pushed the dont-ice-invalid-operator-traits branch from e5df0de to cedaaa6 Compare November 9, 2022 21:02
assert_eq!(generics.params.len(), 0);

if generics.params.len() != 0 {
tcx.sess.emit_fatal(OpMethodGenericParams {
Copy link
Member

@compiler-errors compiler-errors Nov 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be fatal? Fatal errors should be reserved for particularly unrecoverable cases, and this one doesn't seem (at least initially) like one to me.

We could just return None here -- what does that do to the error reporting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a basic emit_err it causes further ICEs in other places. I haven't tried returning None but I assume it's gonna emit further errors about things not being found.

This code path is only hit when using no_core in weird ways (like by being a fuzzer) so I don't think we should care too much about recovery.

@estebank
Copy link
Contributor

@compiler-errors is right that we should avoid fatal errors, but in the interest of removing the existing ICE and given that no_core isn't as common, I'll go ahead and merge.

@bors r+

@bors
Copy link
Contributor

bors commented Nov 10, 2022

📌 Commit cedaaa6 has been approved by estebank

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 10, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Nov 11, 2022
…r-traits, r=estebank

Don't ICE on operator trait methods with generic methods

Emit a fatal error instead.
fixes rust-lang#104213
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 11, 2022
Rollup of 9 pull requests

Successful merges:

 - rust-lang#100633 (Consider `#[must_use]` annotation on `async fn` as also affecting the `Future::Output`)
 - rust-lang#103445 (`#[test]`: Point at return type if `Termination` bound is unsatisfied)
 - rust-lang#103924 (Fix broken link in description of error code E0706)
 - rust-lang#104146 (Retry binding TCP Socket in remote-test-server)
 - rust-lang#104169 (Migrate `:target` rules to use CSS variables)
 - rust-lang#104202 (Fix ICE rust-lang#103748)
 - rust-lang#104216 (Don't ICE on operator trait methods with generic methods)
 - rust-lang#104217 (Display help message when fluent arg was referenced incorrectly)
 - rust-lang#104245 (Reduce default configuration's dependency upon static libstdcpp library (rust-lang#103606))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e83b476 into rust-lang:master Nov 11, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 11, 2022
@Noratrieb Noratrieb deleted the dont-ice-invalid-operator-traits branch November 11, 2022 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE with add lang-item with generic param
5 participants